package com.dkm.biz.gl.repository.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.dkm.base.core.helper.SpringHelper;
import com.dkm.base.db.persistence.dao.IQueryDao;
import com.dkm.biz.gl.domain.EavValueDatetime;
import com.dkm.biz.gl.persistence.dao.EavValueDatetimeQueryDao;
import com.dkm.biz.gl.persistence.entity.EavValueDatetimePo;
import com.dkm.biz.gl.repository.EavValueDatetimeRepository;
import com.dkm.biz.repository.AbstractRepository;

/**
 * 对象功能:属性值时间 Repository接口的实现类
 * 开发公司:SKG.COM
 * 开发人员:Yuki
 * 创建时间:2014-12-19 10:20:20
 */
@Repository
public class EavValueDatetimeRepositoryImpl extends AbstractRepository<String, EavValueDatetimePo,EavValueDatetime> implements EavValueDatetimeRepository{
	  
	@Resource
	private  EavValueDatetimeQueryDao eavValueDatetimeQueryDao;

	public EavValueDatetime newInstance() {
		EavValueDatetimePo po = new EavValueDatetimePo();
		EavValueDatetime eavValueDatetime = SpringHelper.getBean(EavValueDatetime.class);
		eavValueDatetime.setData(po);
		return eavValueDatetime;
	}

	public EavValueDatetime newInstance(EavValueDatetimePo po) {
		EavValueDatetime eavValueDatetime = SpringHelper.getBean(EavValueDatetime.class);
		eavValueDatetime.setData(po);
		return eavValueDatetime;
	} 
	
	@Override
	protected IQueryDao<String, EavValueDatetimePo> getQueryDao() {
		return eavValueDatetimeQueryDao;
	}
	public EavValueDatetimePo findByProdAttr(String entityId, String attrId){
		 Map<String,Object> params=new HashMap<String,Object>();
			params.put("entityId",entityId);
			params.put("attrId", attrId);
			return eavValueDatetimeQueryDao.getByKey("findByProdAttr", params);
	}
	@Override
	public List<EavValueDatetimePo> findAllByEntityId(String entityId) {
		Map<String,Object> params=new HashMap<String,Object>();
		params.put("whereSql"," entity_id_='"+entityId+"'");
		return  eavValueDatetimeQueryDao.findAll(params);
	}
}
